home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
jpl_c.zip
/
TOBASE.C
< prev
next >
Wrap
Text File
|
1988-08-06
|
768b
|
28 lines
/* 1.0 01-08-86 (tobase.c)
************************************************************************
* Robert C. Tausworthe *
* Jet Propulsion Laboratory *
* Pasadena, CA 91009 1986 *
************************************************************************/
#include "defs.h"
#include "stdtyp.h"
/************************************************************************/
METACHAR
tobase(c, b) /* Return value of character c to base b, if
valid, or EOF if not. */
/*----------------------------------------------------------------------*/
{
int n;
if (isdigit(c = tolower(c)))
c -= '0';
else if (isalpha(c))
c -= 'W'; /* 'W' is 'a' - 10 */
else
return EOF;
return (c < b ? c : EOF);
}